<!DOCTYPE html>
<html>
<head>
    <title>管理员登录测试</title>
    <style>
        .modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); }
        .modal-content { background: white; margin: 15% auto; padding: 20px; width: 300px; border-radius: 10px; }
        .admin-dashboard { display: none; background: white; padding: 20px; margin: 20px; border-radius: 10px; }
        button { padding: 10px 20px; margin: 5px; cursor: pointer; }
        input { padding: 8px; margin: 5px; }
    </style>
</head>
<body>
    <h1>管理员登录测试</h1>
    
    <button onclick="openModal()">打开登录窗口</button>
    
    <div id="adminModal" class="modal">
        <div class="modal-content">
            <h2>管理员登录</h2>
            <form id="adminLoginForm">
                <div>
                    <label>用户名:</label>
                    <input type="text" id="adminUser" value="admin">
                </div>
                <div>
                    <label>密码:</label>
                    <input type="password" id="adminPass" value="king888">
                </div>
                <button type="submit">登录</button>
                <button type="button" onclick="closeModal()">关闭</button>
            </form>
        </div>
    </div>
    
    <div id="adminDashboard" class="admin-dashboard">
        <h2>✅ 登录成功！这是管理后台</h2>
        <p>所有功能已激活！</p>
        <button onclick="closeDashboard()">退出</button>
    </div>

    <script>
        function openModal() {
            document.getElementById('adminModal').style.display = 'block';
        }
        
        function closeModal() {
            document.getElementById('adminModal').style.display = 'none';
        }
        
        function closeDashboard() {
            document.getElementById('adminDashboard').style.display = 'none';
        }
        
        function handleLogin(e) {
            e.preventDefault();
            const username = document.getElementById('adminUser').value;
            const password = document.getElementById('adminPass').value;
            
            console.log('登录尝试:', username, password);
            
            if (username === 'admin' && password === 'king888') {
                alert('登录成功！');
                closeModal();
                document.getElementById('adminDashboard').style.display = 'block';
            } else {
                alert('用户名或密码错误！');
            }
        }
        
        // 绑定表单提交事件
        document.addEventListener('DOMContentLoaded', function() {
            const form = document.getElementById('adminLoginForm');
            if (form) {
                form.addEventListener('submit', handleLogin);
            }
        });
    </script>
</body>
</html>